﻿package com.mini.framework.bi.bpull.chart;

import java.util.ArrayList;
import java.util.List;

import com.mini.framework.bi.bpull.model.PieMap;

/**
 * 
 * @author lishsh.
 *
 */
public class PieMapChart {
	
	private String t_1;//标题说明.
	
	private List<PieMap> datas;//pieMap数据.

	public String getT_1() {
		return t_1;
	}

	public void setT_1(String t_1) {
		this.t_1 = t_1;
	}

	public List<PieMap> getDatas() {
		return datas;
	}

	public void setDatas(List<PieMap> datas) {
		this.datas = datas;
	}
	
	//返回xml数据.
	public  String getXml(){
		StringBuilder sb = new StringBuilder();
		//sb.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
		sb.append("<data t_1=\""+this.getT_1()+"\" cp=\"false\" cn=\"\">");
		for(PieMap pieMap:this.getDatas()){
			sb.append("<l n=\""+pieMap.getN()+"\" d_1=\""+pieMap.getD_1()+"\" />");
		}
		sb.append("</data>");
		return sb.toString();
	}
	
	public static void main(String arg[]){
		List<PieMap> datas = new ArrayList<PieMap>();
		PieMapChart chart = new PieMapChart();
		PieMap data1 = new PieMap();
		data1.setN("广东");
		data1.setD_1("100");
		PieMap data2 = new PieMap();
		data2.setN("天津");
		data2.setD_1("90");
		PieMap data3 = new PieMap();
		data3.setN("上海");
		data3.setD_1("70");
		datas.add(data1);
		datas.add(data2);
		datas.add(data3);
		chart.setT_1("PV-高到低");
		chart.setDatas(datas);
		System.out.println(chart.getXml());
	}
	
	
	
	

}
